home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <dos.h>
- #include "define.h"
- /* #include <cdrfrb.h> */
-
- #ifdef DEBUG
- main(int argc, char *argv[])
- {
- struct TIMEADRS time, end_time;
-
- printf("return is %x\n", cdr_rmtplay(0, &time, &end_time));
- printf("start %d分 %d秒 %dフレーム\n", time.min, time.sec, time.frame);
- printf("end %d分 %d秒 %dフレーム\n", end_time.min, end_time.sec, end_time.frame);
-
- }
- #endif
-
- /* 音楽演奏情報の読み取り(時間指定) */
- /*
- * decice_no: device number (Towns CD-ROM -> 0)
- * start_time: 演奏開始時間
- * end_time: 演奏終了時間
- * return: 0 -> 正常終了, 0以外 -> エラー
- */
- int cdr_rmtplay(int device_no, struct TIMEADRS *start_time, struct TIMEADRS *end_time)
- {
- union REGS reg;
- struct SREGS seg;
- char buf[6];
-
- reg.h.ah = 0x51;
- reg.h.al = (0xC0 | (u_char) device_no);
- reg.x.cx = 0x0001;
-
- reg.x.di = (u_int) buf;
- segread(&seg);
- seg.ds = seg.ss;
-
- int86x(0x93, ®, ®, &seg);
-
- if (start_time) {
- start_time->min = buf[0]; /* 分 */
- start_time->sec = buf[1]; /* 秒 */
- start_time->frame = buf[2]; /* フレーム */
- }
- if (end_time) {
- end_time->min = buf[3]; /* 分 */
- end_time->sec = buf[4]; /* 秒 */
- end_time->frame =buf[5]; /* フレーム */
- }
- if (reg.h.ah == 0) {
- return 0;
- } else if (reg.h.ah == 0x02) { /* device number error */
- return DEVERR;
- } else { /* (reg.h.ah == 0x80) hard ware error */
- return reg.x.cx;
- }
- }
-
-